package io.xiaojl.xj2ee.modules.oss.service.impl;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;

import io.xiaojl.xj2ee.common.kit.PageWrapper;
import io.xiaojl.xj2ee.modules.oss.entity.SysOssEntity;
import io.xiaojl.xj2ee.modules.oss.mapper.SysOssEntityMapper;
import io.xiaojl.xj2ee.modules.oss.service.SysOssService;


@Service("sysOssService")
public class SysOssServiceImpl implements SysOssService {
	@Autowired
	private SysOssEntityMapper baseMapper;
	
	@Override
	public PageWrapper<SysOssEntity> queryPage(Map<String, Object> params) {
		PageWrapper<SysOssEntity> pageWrapper = new PageWrapper<>(params);
		PageHelper.startPage(pageWrapper.getCurrPage(), pageWrapper.getPageSize(), pageWrapper.getOrderBy());
		
		List<SysOssEntity> list = baseMapper.selectListByPage(pageWrapper.getCondition());
		PageInfo<SysOssEntity> page = new PageInfo<>(list);
		
		pageWrapper.setList(page.getList());
		pageWrapper.setTotalCount(Integer.parseInt(page.getTotal()+""));
		pageWrapper.setTotalPage(page.getPages());
        return pageWrapper;
	}

	@Override
	public int insert(SysOssEntity ossEntity) {
		return baseMapper.insertSelective(ossEntity);
	}

	@Override
	public int deleteBatchIds(Long[] ids) {
		return baseMapper.deleteBatchIds(ids);
	}
	
}
